{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "collapsed": true,
        "pycharm": {
          "is_executing": false
        }
      },
      "source": []
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "pycharm": {
          "is_executing": true
        }
      },
      "outputs": [],
      "source": [
        "from alpaca_client.alpaca_serving.client import *\n",
        "from alpaca_server.alpaca_model.pytorchAPI import *\n",
        "x_train, y_train \u003d utils.load_data_and_labels(\u0027train.bio\u0027)\n",
        "sent \u003d x_train[0:10]\n",
        "label \u003d y_train[0:10]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "pycharm": {
          "is_executing": false,
          "metadata": false,
          "name": "#%% !ls\n"
        }
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "b\u0027{\"client\":\"91838226-ad3e-406b-8667-01b6983ceaa4\",\"num_process\":2,\"ventilator -\u003e worker\":[\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpvajMU6/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpx0wCSK/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpT3WqSs/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpMsLink/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpJ2jEqL/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpHA5E5J/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpXp7A2e/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpKG7LKa/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmp8mY7QU/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpHYGGsu/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmp7gmGmU/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpybdTiE/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmphEwmBA/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpv6QdxA/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpE04TsI/socket\",\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpwA9ypZ/socket\"],\"worker -\u003e sink\":\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmpbapXyR/socket\",\"ventilator \u003c-\u003e sink\":\"ipc:///var/folders/_n/vmjp6n_d6tnffbjbt12tt9040000gn/T/tmprWgqAI/socket\",\"server_current_time\":\"2019-07-10 03:24:27.402044\",\"statistic\":{\"num_data_request\":0,\"num_total_seq\":0,\"num_sys_request\":527,\"num_total_request\":527,\"num_total_client\":92,\"num_active_client\":0,\"avg_request_per_client\":5.728260869565218,\"min_request_per_client\":1,\"max_request_per_client\":9,\"num_min_request_per_client\":12,\"num_max_request_per_client\":1},\"device_map\":[],\"num_concurrent_socket\":16,\"batch_size\":256,\"ckpt_name\":\"bert_model.ckpt\",\"config_name\":\"bert_config.json\",\"cors\":\"*\",\"cpu\":false,\"do_lower_case\":true,\"epoch\":256,\"fixed_embed_length\":false,\"fp16\":false,\"gpu_memory_fraction\":0.5,\"graph_tmp_dir\":null,\"http_max_connect\":10,\"http_port\":null,\"max_seq_len\":25,\"model_dir\":null,\"num_worker\":1,\"port\":5555,\"port_out\":5556,\"prefetch_size\":10,\"show_tokens_to_client\":false,\"tuned_model_dir\":null,\"xla\":false,\"python_version\":\"3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37) \\\\n[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]\",\"server_version\":\"1.0.1\",\"pyzmq_version\":\"18.0.0\",\"zmq_version\":\"4.3.1\",\"server_start_time\":\"2019-07-09 02:30:10.364427\"}\u0027\n"
          ]
        },
        {
          "ename": "TimeoutError",
          "evalue": "no response from the server (with \"timeout\"\u003d3000 ms), please check the following:is the server still online? is the network broken? are \"port\" and \"port_out\" correct? are you encoding a huge amount of data whereas the timeout is too small for that?",
          "output_type": "error",
          "traceback": [
            "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
            "\u001b[0;31mAgain\u001b[0m                                     Traceback (most recent call last)",
            "\u001b[0;32m~/Documents/GitHub/AlpacaTag/alpaca_client/alpaca_serving/client/__init__.py\u001b[0m in \u001b[0;36marg_wrapper\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m    150\u001b[0m             \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--\u003e 151\u001b[0;31m                 \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    152\u001b[0m             \u001b[0;32mexcept\u001b[0m \u001b[0mzmq\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0merror\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mAgain\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0m_e\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
            "\u001b[0;32m~/Documents/GitHub/AlpacaTag/alpaca_client/alpaca_serving/client/__init__.py\u001b[0m in \u001b[0;36mserver_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m    199\u001b[0m         \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_recv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreq_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcontent\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--\u003e 200\u001b[0;31m         \u001b[0;32mreturn\u001b[0m \u001b[0mjsonapi\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloads\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_recv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreq_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcontent\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    201\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
            "\u001b[0;32m~/Documents/GitHub/AlpacaTag/alpaca_client/alpaca_serving/client/__init__.py\u001b[0m in \u001b[0;36m_recv\u001b[0;34m(self, wait_for_req_id)\u001b[0m\n\u001b[1;32m    109\u001b[0m         \u001b[0;32mexcept\u001b[0m \u001b[0mException\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--\u003e 110\u001b[0;31m             \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    111\u001b[0m         \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
            "\u001b[0;32m~/Documents/GitHub/AlpacaTag/alpaca_client/alpaca_serving/client/__init__.py\u001b[0m in \u001b[0;36m_recv\u001b[0;34m(self, wait_for_req_id)\u001b[0m\n\u001b[1;32m     99\u001b[0m                 \u001b[0;31m# receive a response\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--\u003e 100\u001b[0;31m                 \u001b[0mresponse\u001b[0m \u001b[0;34m\u003d\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreceiver\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecv_multipart\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    101\u001b[0m                 \u001b[0mrequest_id\u001b[0m \u001b[0;34m\u003d\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
            "\u001b[0;32m~/miniconda3/envs/alpaca/lib/python3.6/site-packages/zmq/sugar/socket.py\u001b[0m in \u001b[0;36mrecv_multipart\u001b[0;34m(self, flags, copy, track)\u001b[0m\n\u001b[1;32m    469\u001b[0m         \"\"\"\n\u001b[0;32m--\u003e 470\u001b[0;31m         \u001b[0mparts\u001b[0m \u001b[0;34m\u003d\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mflags\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[0;34m\u003d\u001b[0m\u001b[0mcopy\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtrack\u001b[0m\u001b[0;34m\u003d\u001b[0m\u001b[0mtrack\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    471\u001b[0m         \u001b[0;31m# have first part already, only loop while more to receive\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
            "\u001b[0;32mzmq/backend/cython/socket.pyx\u001b[0m in \u001b[0;36mzmq.backend.cython.socket.Socket.recv\u001b[0;34m()\u001b[0m\n",
            "\u001b[0;32mzmq/backend/cython/socket.pyx\u001b[0m in \u001b[0;36mzmq.backend.cython.socket.Socket.recv\u001b[0;34m()\u001b[0m\n",
            "\u001b[0;32mzmq/backend/cython/socket.pyx\u001b[0m in \u001b[0;36mzmq.backend.cython.socket._recv_copy\u001b[0;34m()\u001b[0m\n",
            "\u001b[0;32mzmq/backend/cython/socket.pyx\u001b[0m in \u001b[0;36mzmq.backend.cython.socket._recv_copy\u001b[0;34m()\u001b[0m\n",
            "\u001b[0;32m~/miniconda3/envs/alpaca/lib/python3.6/site-packages/zmq/backend/cython/checkrc.pxd\u001b[0m in \u001b[0;36mzmq.backend.cython.checkrc._check_rc\u001b[0;34m()\u001b[0m\n",
            "\u001b[0;31mAgain\u001b[0m: Resource temporarily unavailable",
            "\nThe above exception was the direct cause of the following exception:\n",
            "\u001b[0;31mTimeoutError\u001b[0m                              Traceback (most recent call last)",
            "\u001b[0;32m\u003cipython-input-5-f0aef15976a3\u003e\u001b[0m in \u001b[0;36m\u003cmodule\u003e\u001b[0;34m\u001b[0m\n\u001b[0;32m----\u003e 1\u001b[0;31m \u001b[0mac\u001b[0m \u001b[0;34m\u003d\u001b[0m \u001b[0mAlpacaClient\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
            "\u001b[0;32m~/Documents/GitHub/AlpacaTag/alpaca_client/alpaca_serving/client/__init__.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, ip, port, port_out, output_fmt, show_server_config, identity, check_version, check_length, check_token_info, ignore_all_checks, timeout)\u001b[0m\n\u001b[1;32m     54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     55\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mignore_all_checks\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mcheck_version\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mshow_server_config\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mcheck_length\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mcheck_token_info\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---\u003e 56\u001b[0;31m             \u001b[0ms_status\u001b[0m \u001b[0;34m\u003d\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mserver_status\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     57\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     58\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0mcheck_version\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0ms_status\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\u0027server_version\u0027\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m!\u003d\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatus\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\u0027client_version\u0027\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
            "\u001b[0;32m~/Documents/GitHub/AlpacaTag/alpaca_client/alpaca_serving/client/__init__.py\u001b[0m in \u001b[0;36marg_wrapper\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m    158\u001b[0m                     \u001b[0;32mraise\u001b[0m \u001b[0mt_e\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    159\u001b[0m                 \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--\u003e 160\u001b[0;31m                     \u001b[0m_raise\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mt_e\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_e\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    161\u001b[0m             \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    162\u001b[0m                 \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreceiver\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msetsockopt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mzmq\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRCVTIMEO\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
            "\u001b[0;32m~/Documents/GitHub/AlpacaTag/alpaca_client/alpaca_serving/client/_py3_.py\u001b[0m in \u001b[0;36m_raise\u001b[0;34m(t_e, _e)\u001b[0m\n\u001b[1;32m      7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      8\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_raise\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mt_e\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_e\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----\u003e 9\u001b[0;31m     \u001b[0;32mraise\u001b[0m \u001b[0mt_e\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0m_e\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
            "\u001b[0;31mTimeoutError\u001b[0m: no response from the server (with \"timeout\"\u003d3000 ms), please check the following:is the server still online? is the network broken? are \"port\" and \"port_out\" correct? are you encoding a huge amount of data whereas the timeout is too small for that?"
          ]
        }
      ],
      "source": [
        "ac \u003d AlpacaClient()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "2\n"
          ]
        },
        {
          "data": {
            "text/plain": [
              "\u0027Model Loaded\u0027"
            ]
          },
          "execution_count": 4,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "ac.initiate(1)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "\u0027Online word build completed\u0027"
            ]
          },
          "execution_count": 5,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "ac.online_initiate(x_train[:50], [[\u0027B-PER\u0027, \u0027I-PER\u0027, \u0027B-LOC\u0027, \u0027I-LOC\u0027, \u0027B-ORG\u0027, \u0027I-ORG\u0027, \u0027B-MISC\u0027, \u0027I-MISC\u0027, \u0027O\u0027]])"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 30,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "\u0027Online learning completed\u0027"
            ]
          },
          "execution_count": 30,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "ac.online_learning(x_train[:50],y_train[:50])"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 31,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "{\u0027words\u0027: [\u0027Paris\u0027, \u0027and\u0027, \u0027New\u0027, \u0027York\u0027, \u0027and\u0027, \u0027Los\u0027, \u0027Angeles\u0027],\n",
              " \u0027entities\u0027: [],\n",
              " \u0027tags\u0027: [[\u0027O\u0027, \u0027O\u0027, \u0027O\u0027, \u0027O\u0027, \u0027O\u0027, \u0027O\u0027, \u0027O\u0027]]}"
            ]
          },
          "execution_count": 31,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "ac.predict(\"Paris and New York and Los Angeles\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 32,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "\u0027Online learning completed\u0027"
            ]
          },
          "execution_count": 32,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "ac.online_learning(sent,label)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 33,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "{\u0027words\u0027: [\u0027English\u0027, \u0027lamb\u0027], \u0027entities\u0027: [], \u0027tags\u0027: [[\u0027O\u0027, \u0027O\u0027]]}"
            ]
          },
          "execution_count": 33,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "ac.predict(\"English lamb\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "pycharm": {
          "is_executing": false
        }
      },
      "outputs": [
        {
          "traceback": [
            "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
            "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
            "\u001b[0;32m\u003cipython-input-1-7401599cfa77\u003e\u001b[0m in \u001b[0;36m\u003cmodule\u003e\u001b[0;34m\u001b[0m\n\u001b[0;32m----\u003e 1\u001b[0;31m \u001b[0mac\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0monline_learning\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msent\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mlabel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
            "\u001b[0;31mNameError\u001b[0m: name \u0027ac\u0027 is not defined"
          ],
          "ename": "NameError",
          "evalue": "name \u0027ac\u0027 is not defined",
          "output_type": "error"
        }
      ],
      "source": "ac.online_learning(sent,label)"
    },
    {
      "cell_type": "code",
      "execution_count": 44,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "[2, 30]"
            ]
          },
          "execution_count": 44,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": "ac.active_learning(x_train[:50],2)"
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": []
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": []
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": []
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": []
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": []
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.6.5"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 1
}